package 力扣日常刷题.木22一月.第05天0113;

import java.util.HashSet;
import java.util.Set;

/**
 * @author 帅小伙
 * @date 2022/1/13
 * @description
 */
public class Demo10哈希中等找出不同的二进制字符串 {


    public String findDifferentBinaryString(String[] nums) {
        int len = nums[0].length();
        Set<String> set = new HashSet<>();
        for(String num : nums){
            set.add(num);
        }

        for (int i = 0; i < Math.pow(2,len); i++) {
            StringBuilder sb = new StringBuilder();
            int temp = i;
            for (int j = 0; j < len; j++) {
                if((temp >> j & 1) ==1){
                    sb.append(1);
                }else{
                    sb.append(0);
                }
            }
            if(!set.contains(sb.toString())){
                return sb.toString();
            }
        }
        return null;
    }

}
